<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!--
 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
 * Copyright (C) 2003-2010 Frederico Caldeira Knabben
 *
 * == BEGIN LICENSE ==
 *
 * Licensed under the terms of any of the following licenses at your
 * choice:
 *
 *  - GNU General Public License Version 2 or later (the "GPL")
 *    http://www.gnu.org/licenses/gpl.html
 *
 *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
 *    http://www.gnu.org/licenses/lgpl.html
 *
 *  - Mozilla Public License Version 1.1 or later (the "MPL")
 *    http://www.mozilla.org/MPL/MPL-1.1.html
 *
 * == END LICENSE ==
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>FCKKeystrokeHandler Test</title>
	<script type="text/javascript">

// Used by fckconfig
var FCK = new Object() ;

	</script>
	<script src="../../../editor/_source/fckconstants.js" type="text/javascript"></script>
	<script src="../../../editor/_source/fckjscoreextensions.js" type="text/javascript"></script>
	<script src="../../../editor/_source/internals/fcktools.js" type="text/javascript"></script>
	<script src="../../../editor/_source/internals/fckbrowserinfo.js" type="text/javascript"></script>
	<script src="../../../editor/_source/classes/fckiecleanup.js" type="text/javascript"></script>
	<script src="../../../editor/_source/internals/fckconfig.js" type="text/javascript"></script>
	<script src="../../../fckconfig.js" type="text/javascript"></script>
	<script src="../../../editor/_source/internals/fckdebug.js" type="text/javascript"></script>
	<script src="../../../editor/_source/classes/fckkeystrokehandler.js" type="text/javascript"></script>
	<script type="text/javascript">

function LoadScript( url )
{
	document.write( '<script type="text/javascript" src="' + url + '"><\/script>' ) ;
}
var sSuffix = /msie/.test( navigator.userAgent.toLowerCase() ) ? 'ie' : 'gecko' ;
LoadScript( '../../../editor/_source/internals/fcktools_' + sSuffix + '.js' ) ;

	</script>
	<script type="text/javascript">

FCKConfig.Debug = false ;
FCKConfig.BasePath = '../../../editor/' ;

window.onload = function()
{
	var keystrokeHandler = new FCKKeystrokeHandler() ;
	keystrokeHandler.OnKeystroke = KeystrokeHandler_OnKeystroke ;
	keystrokeHandler.AttachToElement( document ) ;

	keystrokeHandler.SetKeystrokes(
		[ 13 /*ENTER*/, 'Enter' ],
		[ SHIFT + 13 /*ENTER*/, 'Shift + Enter' ],
		[ 8 /*BACKSPACE*/, 'Backspace' ],
		[ 46 /*DELETE*/, 'Delete' ],

		[ CTRL + 67 /*C*/, 'Copy' ],
		// [ CTRL + 86 /*V*/, 'Paste' ],
		[ SHIFT + 45 /*INS*/, 'Paste' ],
		[ CTRL + 88 /*X*/, 'Cut' ],
		[ SHIFT + 46 /*DEL*/, 'Cut' ],
		[ CTRL + 90 /*Z*/, 'Undo' ],
		[ CTRL + 89 /*Y*/, 'Redo' ],
		[ CTRL + SHIFT + 90 /*Z*/, 'Redo' ],
		[ CTRL + 65 /*A*/, 'SelectAll' ],
		[ CTRL + 70 /*F*/, 'Find' ],
		[ CTRL + 72 /*H*/, 'Replace' ],
		[ CTRL + 76 /*L*/, 'Link' ],
		[ CTRL + 66 /*B*/, 'Bold' ],
		[ CTRL + 73 /*I*/, 'Italic' ],
		[ CTRL + 85 /*U*/, 'Underline' ],
		[ ALT + 13 /*ENTER*/, 'FitWindow' ],
		[ 121 /*F10*/, 'FitWindow' ],
		[ CTRL + 9 /*TAB*/, 'Source' ]
	) ;
}

function KeystrokeHandler_OnKeystroke( keystroke, keystrokeValue )
{
	var dump = document.getElementById( 'xDump' ) ;

	dump.value = keystroke + ' : ' + keystrokeValue + '\n' + dump.value ;

	// Cancel the keystroke.
	return true ;
}
	</script>
</head>
<body>
	<h1>
		FCKKeystrokeHandler Test</h1>
	<table width="100%" height="80%">
		<tr>
			<td>
				<pre>
[ 13 /*ENTER*/, 'Enter' ]
[ SHIFT + 13 /*ENTER*/, 'Shift + Enter' ]
[ 8 /*ENTER*/, 'Backspace' ]
[ 46 /*ENTER*/, 'Delete' ]

[ CTRL + 67 /*C*/, 'Copy' ]
// [ CTRL + 86 /*V*/, 'Paste' ]
[ SHIFT + 45 /*INS*/, 'Paste' ]
[ CTRL + 88 /*X*/, 'Cut' ]
[ SHIFT + 46 /*DEL*/, 'Cut' ]
[ CTRL + 90 /*Z*/, 'Undo' ]
[ CTRL + 89 /*Y*/, 'Redo' ]
[ CTRL + SHIFT + 90 /*Z*/, 'Redo' ]
[ CTRL + 65 /*A*/, 'SelectAll' ]
[ CTRL + 70 /*F*/, 'Find' ]
[ CTRL + 72 /*H*/, 'Replace' ]
[ CTRL + 76 /*L*/, 'Link' ]
[ CTRL + 66 /*B*/, 'Bold' ]
[ CTRL + 73 /*I*/, 'Italic' ]
[ CTRL + 85 /*U*/, 'Underline' ]
[ ALT + 13 /*ENTER*/, 'FitWindow' ]
[ 121 /*F10*/, 'FitWindow' ]
[ CTRL + 9 /*TAB*/, 'Source' ]
</pre>
				<p>
					CTRL + V is not defined in the list, but must be cancelled, as it is a combination
					with CTRL.
				</p>
			</td>
			<td width="100%">
				<textarea rows="4" cols="80" style="width: 100%; height: 40%">Type here and check the results in the field bellow.</textarea>
				<textarea id="xDump" rows="10" cols="80" style="width: 100%; height: 60%" readonly="readonly"></textarea>
			</td>
		</tr>
	</table>
</body>
</html>
